<template>
  <view class="container">
    <view class="form-box">
      <text class="title">注册</text>
      <input class="input" placeholder="请输入用户名" v-model="username" />
      <input class="input" placeholder="请输入密码" password v-model="password" />
      <input class="input" placeholder="请确认密码" password v-model="confirmPassword" />
      <button class="btn" @click="register">注册</button>
      <navigator url="/pages/Login/Login" class="link-text">
        已有账号？去登录
      </navigator>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
      confirmPassword: ''
    };
  },
  methods: {
    register() {
      if (this.password !== this.confirmPassword) {
        uni.showToast({
          title: '两次输入的密码不一致',
          icon: 'none'
        });
        return;
      }
	  uni.navigateTo({
	  	url:"/pages/Login/Login"
	  })
      console.log('用户名：', this.username);
      console.log('密码：', this.password);
    }
  }
};
</script>

<style>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8f8f8;
}

.form-box {
  width: 80%;
  max-width: 400px;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.title {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

.input {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.btn {
  width: 100%;
  padding: 10px;
  background-color: #007aff;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  margin-top: 10px;
}

.link-text {
  display: block;
  text-align: center;
  margin-top: 15px;
  color: #007aff;
}
</style>